<template>
    <div>
        <van-tabs class="tabs" id="tab" v-model="activeName" sticky title-active-color="#fe4070" lazy-render animated :swipeable="true"> <!--去拼团tabbar-->
            <van-tab v-for="item in tab_list" :title="item.name" :name="item.path" :key="item.id">
                <list-item :contuan_data="item.path" id="top"></list-item> <!--内容-->
            </van-tab>
        </van-tabs>
    </div>
</template>

<script>
import listItem from './components/list-item'
export default {
    name: "index",
    data() {
        return {
            activeName: 'coutuan_home',
            tab_list: [
                {path: 'coutuan_home', name: '推荐',id: 0},
                {path: 'coutuan_makeup', name: '美妆',id: 1},
                {path: 'coutuan_baby', name: '沐浴健康',id: 2},
                {path: 'coutuan_underwear', name: '内衣',id: 3},
                {path: 'coutuan_ladies', name: '女装',id: 4},
                {path: 'coutuan_furniture', name: '家居',id: 5},
                {path: 'coutuan_food', name: '食品保健',id: 6},
            ],
            goTop: false
        }
    },
    components: {
        listItem
    },
    // mounted () {
    //     window.addEventListener('scroll', this.handleScroll)
    // },
    // methods:{
    //     handleScroll () {
    //         this.scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
    //         var offsetTop = 50 // 垂直滚动条滚动距离
    //         if (this.scrollTop > offsetTop) {
    //             this.goTop = true
    //         } else {
    //             this.goTop = false
    //         }
    //     },
    //     handleToTop(){
    //         let timer = setInterval(() => {
    //             let ispeed = Math.floor(-this.scrollTop / 5)
    //             document.documentElement.scrollTop = document.body.scrollTop = this.scrollTop + ispeed
    //             console.log(this.scrollTop)
    //             if (this.scrollTop === 0) {
    //                 clearInterval(timer)
    //             }
    //         }, 50)
    //     }
    // },
    // destroyed() {
    //     window.removeEventListener('scroll', this.handleScroll)
    // }
}
</script>

<style scoped>

</style>
